home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part1 / 9445 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.7 KB

  1. Path: news.sunquest.com!kitk!kitk
  2. From: kitk@mudshark.sunquest.com (Kit Kauffmann)
  3. Newsgroups: comp.lang.c++
  4. Subject: Re: Could use some help...
  5. Date: Fri, 1 Mar 1996 11:43:05
  6. Organization: Sunquest
  7. Message-ID: <kitk.2116.000BB833@mudshark.sunquest.com>
  8. References: <4h632q$eij@thor.cmp.ilstu.edu>
  9. NNTP-Posting-Host: kkauffma.sunquest.com
  10. X-Newsreader: Trumpet for Windows [Version 1.0 Rev A]
  11.  
  12. In article <4h632q$eij@thor.cmp.ilstu.edu> edstanf@rs6000.cmp.ilstu.edu (Eric D. Stanfield) writes:
  13. >From: edstanf@rs6000.cmp.ilstu.edu (Eric D. Stanfield)
  14. >Subject: Could use some help...
  15. >Date: 1 Mar 1996 05:48:10 GMT
  16.  
  17. >Here's my prob:
  18.  
  19. >  void check_board(int [], int [5][5], int [5][5]); // prototype
  20.  
  21. >  // Heres the function:
  22.  
  23. >void check_board(int bingo_numbers[], int start_numbers[5][5], int
  24. >new_board[5][5]) {
  25. >  int i, j, x, y, z;
  26.  
  27. >  for(y = 0; y < 5; y++)
  28. >    for(z = 0; z < 5; z++)
  29. >      new_board[y][z] = 0;
  30.  
  31. >  for(i = 0; i < 10; i++)
  32. >    for(j = 0; j < 5; j++)
  33. >      for(x = 0; x < 5; x++)
  34. >        if(bingo_numbers[i] = start_numbers[j][k]) //THIS IS THE PROB
  35. >          new_board[j][k] = -1;
  36. >        else
  37. >          new_board[j][k] = start_numbers[j][k];
  38. >}
  39.  
  40. >  The problem is that start_numbers[j][k] does not get copied
  41. >into new_board[j][k].  There are no errors or warnings when I
  42. >compile it and I've traced both arrays and cant find the reason
  43. >this is happening.  Please post if you can help, I'm under the gun
  44. >for time.  Thanks.
  45.  
  46. I think this line:
  47.  
  48. >        if(bingo_numbers[i] = start_numbers[j][k]) //THIS IS THE PROB
  49.  
  50. should read
  51.  
  52.         if(bingo_numbers[i] == start_numbers[j][k]) //THIS IS THE PROB
  53.  
  54. Notice the == (compare) instead of = (assign)
  55.  
  56. HTH!
  57.  
  58.  
  59. Kit Kauffmann - kitk@mudshark.sunquest.com
  60. AKA 73363,447 (Compu$erve)
  61.  
  62. Finger me for my public key
  63.